home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Question-2
- Date: 03 Feb 1996 18:06:34 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Feb3110634@qcd.lanl.gov>
- References: <4eur52$oaq@recepsen.aa.msen.com> <2FEB199622525027@erich.triumf.ca>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: bennett@erich.triumf.ca's message of 2 Feb 1996 22:52 PST
-
- In article <2FEB199622525027@erich.triumf.ca> bennett@erich.triumf.ca
- (P.Bennett) writes:
- >What is the relationship between short, int and long variables?
-
- shorts are shorter than longs. Ints may be the same as either, or not.
-
- Actually, all three are allowed to be equal! But, typically, the above
- answer is correct: except that ints must be `between' short and long.
-
- shorts and ints are guaranteed to be at least 16 bits (including the
- sign bit) and longs are guaranteed to be at least 32 bits. ints are
- expected to be the `natural' integer that the hardware supports: which
- means that they should be used whenever there is no reason to choose
- any particular type (it may mean for example that the code is faster
- or the instructions required to manipulate the data is shorter if ints
- are used.)
-
- In addition, shorts, like chars, are promoted to ints in almost all
- calculations. Preprocessor arithmetic is done as longs.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-